package com.xjgzinfo.usdp.core.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.Instant;

/**
 * QueueMessage
 *
 * @author jinxw
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class QueueMessage implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * Queue region
     */
    private String region;
    /**
     * action 0-reflushToken 1-update-role 2-delete-role 3-update-permission 4-delete-permission
     */
    private int action = 0;
    /**
     * reflush
     */
    private boolean reflush = false;
    /**
     * oldIndexies split ','
     */
    private String oldIndexies;
    /**
     * newIndexies split ','
     */
    private String newIndexies;
    /**
     * Queue token
     */
    private String token;
    /**
     * 创建时间
     */
    private Instant createTime = Instant.now();

    public QueueMessage(String region) {
        this.region = region;
    }

    public QueueMessage(String region, int action, boolean reflush) {
        this.region = region;
        this.action = action;
        this.reflush = reflush;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public int getAction() {
        return action;
    }

    public void setAction(int action) {
        this.action = action;
    }

    public String getOldIndexies() {
        return oldIndexies;
    }

    public void setOldIndexies(String oldIndexies) {
        this.oldIndexies = oldIndexies;
    }

    public String getNewIndexies() {
        return newIndexies;
    }

    public void setNewIndexies(String newIndexies) {
        this.newIndexies = newIndexies;
    }

    public boolean isReflush() {
        return reflush;
    }

    public void setReflush(boolean reflush) {
        this.reflush = reflush;
    }

    public Instant getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Instant createTime) {
        this.createTime = createTime;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }
}
